package cn.migu.music.hangupsms.utils;

import java.util.HashMap;
import java.util.Map;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;

@AllArgsConstructor(access = AccessLevel.PRIVATE)
@SuppressWarnings("all")
public class ThreadContext {
    public static final String                      TIME_LIMIT   = "timeLimit";
    public static final String                      HANG_UP_TIME = "hangUpTime";
    private static ThreadLocal<Map<String, Object>> context      = ThreadLocal.withInitial(() -> new HashMap<>());

    public static <T> void put(String key, T value) {
        context.get().put(key, value);
    }

    public static <T> T get(String key, Class<T> clazz) {
        return (T) context.get().get(key);
    }

    public static <T> T get(String key) {
        return (T) context.get().get(key);
    }

    public static void clear() {
        context.get().clear();
    }
}
